Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

572
Visualizações
Consent is required to transfer ownership of a file to another user [Google Drive API]

I have a Google Sheets file shared with 1 user - owner (Gmail account) and 2nd user - writer (google service account like @iam.gserviceaccount.com).

I use this function to copy a table from user 1 by user 2 and make the owner of copied file user 1 again:

$ownerPermission = new Google_Service_Drive_Permission([
'type'         => 'user', 
'role'         => 'owner',
'emailAddress' => 'user1@gmail.com'
]);
$requestOwnership = $service->permissions->create($newfileId, $ownerPermission, ['fields' => 'id', 'transferOwnership' => 'true']); 

And all works well until yesterday! Now Gooogle Drive API returns error: Consent is required to transfer ownership of a file to another user

How to fix it?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

This seems to be working as expected as according to this Issue Tracker issue here:

Following up here, this is the expected behavior as currently Drive does not support the changing of the ownership for items which are owned by gmail.com accounts.

over 4 years ago · Santiago Trujillo Relatório

0

This seems to be a recent change to the google API. See also https://developers.google.com/drive/api/guides/manage-sharing

I haven't tried this, but it suggests that you should replace transferOwnership=true with role=writer and pendingOwner=true, and then separately update the permissions as user1@gmail.com with role=owner. I don't know how you do that second step from a gmail.com account though.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda